<html>
<head><meta charset="utf-8"><title>Display of hir::attributes · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Display.20of.20hir.3A.3Aattributes.html">Display of hir::attributes</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="224392002"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Display%20of%20hir%3A%3Aattributes/near/224392002" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Display.20of.20hir.3A.3Aattributes.html#224392002">(Jan 28 2021 at 21:00)</a>:</h4>
<p>In rustdoc, we use <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast_pretty/pprust/fn.attribute_to_string.html">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast_pretty/pprust/fn.attribute_to_string.html</a> , which isn't great in case a literal string has a <code>\\n</code> like this:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#[doc(spotlight = </span><span class="s">"something on \</span>
<span class="s">two lines"</span><span class="cp">]</span><span class="w"></span>
</code></pre></div>
<p>What do you recommend to do in this case?</p>



<a name="224392457"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Display%20of%20hir%3A%3Aattributes/near/224392457" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Display.20of.20hir.3A.3Aattributes.html#224392457">(Jan 28 2021 at 21:04)</a>:</h4>
<p>do you mean <code>\n</code>?</p>



<a name="224392568"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Display%20of%20hir%3A%3Aattributes/near/224392568" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Display.20of.20hir.3A.3Aattributes.html#224392568">(Jan 28 2021 at 21:05)</a>:</h4>
<p>No, the issue is that the <code>\</code> is kept (it might be specific to HTML and rustdoc rendering, not sure. You can see it in this PR: <a href="https://github.com/rust-lang/rust/pull/81438">https://github.com/rust-lang/rust/pull/81438</a></p>



<a name="224392625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Display%20of%20hir%3A%3Aattributes/near/224392625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Display.20of.20hir.3A.3Aattributes.html#224392625">(Jan 28 2021 at 21:05)</a>:</h4>
<p>oh is that the source input?</p>



<a name="224393631"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Display%20of%20hir%3A%3Aattributes/near/224393631" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Display.20of.20hir.3A.3Aattributes.html#224393631">(Jan 28 2021 at 21:14)</a>:</h4>
<p>Normally it should be the cleaned string (and in some cases it is).</p>



<a name="224407754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Display%20of%20hir%3A%3Aattributes/near/224407754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Display.20of.20hir.3A.3Aattributes.html#224407754">(Jan 28 2021 at 23:10)</a>:</h4>
<p>Oh, what a coincidence, I filed on issue on this just today (<a href="https://github.com/rust-lang/rust/issues/81482">#81482</a>), I didn't know you were already fixing it. <span aria-label="grinning" class="emoji emoji-1f600" role="img" title="grinning">:grinning:</span></p>



<a name="224408833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Display%20of%20hir%3A%3Aattributes/near/224408833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Display.20of.20hir.3A.3Aattributes.html#224408833">(Jan 28 2021 at 23:22)</a>:</h4>
<p>I have two different ways to fix it</p>



<a name="224408846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Display%20of%20hir%3A%3Aattributes/near/224408846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Display.20of.20hir.3A.3Aattributes.html#224408846">(Jan 28 2021 at 23:22)</a>:</h4>
<p>I just need everyone to agree on which one haha</p>



<a name="224409629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Display%20of%20hir%3A%3Aattributes/near/224409629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Display.20of.20hir.3A.3Aattributes.html#224409629">(Jan 28 2021 at 23:31)</a>:</h4>
<p><span class="user-mention" data-user-id="120518">@Eric Huss</span> Thanks opening the issue. I linked to it on my PR. I also commented my current local diff in case we want to fix it in pretty print directly. I think this issue was very recent because I don't remember having seen it before...</p>



<a name="224412572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Display%20of%20hir%3A%3Aattributes/near/224412572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Display.20of.20hir.3A.3Aattributes.html#224412572">(Jan 29 2021 at 00:06)</a>:</h4>
<p>It started in 1.44 (<a href="https://doc.rust-lang.org/1.44.0/std/primitive.str.html#method.trim">https://doc.rust-lang.org/1.44.0/std/primitive.str.html#method.trim</a>), so about 7 or 8 months. I just noticed today, though. <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>